package com.example.myservlet;

import com.example.anno.RequestMapping;
import com.example.bean.User;
import com.example.util.CglibUtil;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.io.IOException;
import java.lang.reflect.Method;

@Slf4j
@RequestMapping("/simple")
public class SimpleServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
//        resp.getWriter().write("hello world");
        testCglib();
    }

    public String hello() {
        return "hello";
    }

    public void testCglib() {
        (new CglibUtil()).test();
    }
}